package pw.hais.main.main_app.adapter;

import android.widget.ImageView;
import android.widget.TextView;

import java.util.List;

import pw.hais.app.AppAdapter;
import pw.hais.main.R;
import pw.hais.main.main_app.model.MenuModel;

/**
 * 菜单列表
 * Created by Hais1992 on 2015/12/14.
 */
public class MenuListAdapter extends AppAdapter<MenuModel, MenuListAdapter.ViewHolder> {


    public MenuListAdapter(List<MenuModel> mList, Class<ViewHolder> mHolderClass) {
        super(mList, R.layout.activity_menu_item, mHolderClass);
    }

    @Override
    public void onBindView(int position, ViewHolder mViewHolder, MenuModel mItem) {
        mViewHolder.image_icon.setImageResource(mItem.icon);
        mViewHolder.text_title.setText(mItem.title);
    }

    //反射免FindViewById，名称必须和 XML的 控件ID一样
    public static class ViewHolder extends AppAdapter.ViewHolder {
        public TextView text_title;
        public ImageView image_icon;
    }
}
